home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
301-325
/
disk_313
/
uucp
/
uucp1.lzh
/
src
/
MUtil
/
man.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-11-03
|
1KB
|
63 lines
/*
* MAN.C
*
* MAN <topic>
*
* searches for MAN:topic or MAN:topic.Doc
*/
#include <stdio.h>
#include <stdlib.h>
#include <config.h>
#include "/version.h"
IDENT(".00");
void
main(ac, av)
char *av[];
{
short i;
static char Buf[256];
for (i = 1; i < ac; ++i) {
char *topic = av[i];
if (Man(topic) == 0) {
sprintf(Buf, "MAN:%s", topic);
if (Man(Buf) == 0) {
sprintf(Buf, "MAN:%s.Doc", topic);
if (Man(Buf) == 0)
printf("Unable to open MAN:%s or MAN:%s.Doc\n", topic, topic);
}
}
}
}
Man(file)
char *file;
{
FILE *fi = fopen(file, "r");
char *filter = FindConfig(RFILTER);
short rb = 1;
static char Cmd[256];
if (fi == NULL)
return(0);
if (filter == NULL) {
if ((filter = FindConfig(FILTER)) == NULL) {
printf("UULIB:Config, no 'Filter' entry\n");
return(0);
}
rb = 0;
}
fclose(fi);
if (rb)
sprintf(Cmd, "Run >nil: <nil: %s %s", filter, file);
else
sprintf(Cmd, "%s %s", filter, file);
Execute(Cmd, NULL, NULL);
}